package com.fzsf.drawingboard.bluetooth;


import com.fzsf.drawingboard.bluetooth.hypen.FZWritingPad_Hypen;
import com.fzsf.drawingboard.bluetooth.iskn.FZWritingPad_ISKN;
import com.fzsf.drawingboard.bluetooth.royole.FZWritingPad_RY;

/**
 * Created by Taijl on 2017/9/8.
 * 方正手写板的工厂类
 */

public class FZWritingPadFactory {
    private static FZWritingPad_Hypen hypen = null;
    private static FZWritingPad_RY ry = null;
    private static FZWritingPad_ISKN iskn = null;

    public static <T extends IFZWritingPad> T getFZWritingPad(Class<T> clz) {
        if (clz == FZWritingPad_Hypen.class) {
            return (T) (hypen == null ? hypen = new FZWritingPad_Hypen() : hypen);
        } else if (clz == FZWritingPad_ISKN.class) {
            return (T) (iskn == null ? iskn = new FZWritingPad_ISKN() : iskn);
        } else {
            return (T) (ry == null ? ry = new FZWritingPad_RY() : ry);
        }
    }
}
